#利用函数修饰符，可以为现有函数增加代码而不必修改现有函数代码
from flask import Flask,session

app = Flask(__name__)
#为flask的cookie生成技术提供一个密钥作为种子，任意难度字符串
app.secret_key='testkey'

@app.route('/setuser/<user>')
def setuser(user:str)->str:
    session['user']=user
    return 'user value set to : '+session['user']

@app.route('/getuser')
def getuser()->str:
    return 'user value is currently set to : '+ session['user']

if __name__=='__main__':
    app.run(debug=True)